Skip to content

Conversation

@nicoburns
Copy link
Contributor

@nicoburns nicoburns commented Sep 26, 2025

Related PRs

Introduction

This PR is aimed at enabling Blitz to implement CSS floats on top of Parley. However, the changes made are not float-specific, and will also enable other advanced layouts such as those that have "exluded regions" or want to lay out text into a complex shape.

Changes Made

Add InlineBoxKind enum

A new kind: InlineBoxKind field has been added the InlineBox struct, where InlineBoxKind is defined as:

enum InlineBoxKind {
     InFlow,
     OutOfFlow,
     CustomOutOfFlow,
}
  • InlineBoxKind::InFlow represents the existing kind of inline box that is is laid out in-flow with text like a display: inline-block box in CSS.
  • InlineBoxKind::OutOfFlow is assigned a position during layout in exactly the same way as an InFlow box. However it does not take up space or affect the position of other items (glyphs or boxes) in the layout. This corresponds to a position: absolute box in CSS. Blitz was previously representing this as a zero-sized box, but I have taken the opportunity here to represent it explicitly.
  • InlineBoxKind::CustomOutOfFlow is the box kind for a floated box. Parley does not attempt to lay these out at all. When it encountered a box of this kind it yields control flow back to the caller who then responsible for positioning the box, adjusting the line's position/size, and then resuming layout (details below).

Tasks

  • Allow boxes to marked as in-flow or out-of-flow
  • Allow line-breaking to yield control flow when encountering a box
  • Allow users of parley to the x/y position and the max-width of each line
  • Update selection to account for line offsets
  • Update alignment to be per-line

@nicoburns nicoburns force-pushed the floats branch 6 times, most recently from dd3a1d6 to 62d4418 Compare September 30, 2025 14:25
@nicoburns nicoburns force-pushed the floats branch 2 times, most recently from e7a038b to 257754b Compare October 7, 2025 13:05
@nicoburns nicoburns force-pushed the floats branch 11 times, most recently from f6e5cef to e55c5cb Compare November 3, 2025 14:12
@nicoburns nicoburns force-pushed the floats branch 3 times, most recently from 3a3e5fe to 90fdd2e Compare November 6, 2025 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Floated boxes (CSS Floats)

1 participant